#include "app_buffer.h"
#include "log.h"


int main(int argc, char const *argv[])
{
    //1 初始化n缓存
    Buffer *buffer= app_buffer_init(16);

    //2 添加数据
    app_buffer_write(buffer, "01234567", 8);
    //3 读取数据
    char read_buff[4] = {0};
    app_buffer_read(buffer, read_buff, 4);
    log_info("read_buff:%.*s", 4,read_buff);

    //4 读取数据
    char read_buff2[4] = {0};
    app_buffer_read(buffer, read_buff2, 4);
    log_info("read_buff:%.*s", 4,read_buff2);

    //5 添加数据
    app_buffer_write(buffer, "89babcdef", 9);

     //6 读取数据  
    char read_buff3[10] = {0};
    int read_size= app_buffer_read(buffer, read_buff3, 10);
    log_info("read_buff:%.*s", read_size,read_buff3);

 
    //7 写入数据(失败)  
    app_buffer_write(buffer, "1111111111111111111", 19); 

    return 0;
}
